
//艺人资料编辑
$('.XT-modify').bind('click',function(){
	window.location.href='/m/model/set?modelid='+$(this).attr('_val');
});

//添加艺人相册
$('.XT-album-create').bind('click',function(){
	window.location.href='/m/works?agid='+$(this).attr('_val');
});

//艺人价格设置
$(".XT-price-set").bind('click',function(){
	window.location.href="/m/product?agid="+$(this).attr('_val');
});

//档期管理
$(".XT-schedule-management").bind('click',function(){
	window.location.href="/m/schedule/index/"+$(this).attr("_val");
});

//$(".model_manager_a").bind("click",function(){
//	window.location.href="/i/index/142";
//});

//删除艺人
$('.XT-del').bind('click',function(){
	var obj = $(this).parent().parent().parent();

	if(!confirm("确定要删除艺人吗?")){return}
	$.ajax( {
	    url:'/m/model/del',
	    data:{
	    		id : $(this).attr('_val')
	    },
	    type:'post',
	    cache:false,
	    dataType:'json',
	    success:function(res) {
	        if(res.code ==200 ){
	            obj.remove();
	        }else{
	            var msg = '';
            	$.each(res.data.error_messages,function(n,value) {
	            	msg +=value+'\n';
	            });
	            if(msg!='')
	            	alert(msg);
	        }
	     }
	});
});

//删除艺人
$('.XT-hangup').bind('click',function(){
    var obj = $(this).parent().parent().parent();

    if(!confirm("确定要"+$(this).attr('title')+"艺人吗?")){return}
    $.ajax( {
        url:'/m/model/hangup',
        data:{
            id : $(this).attr('_val'),
            set_status : $(this).attr('_hangup_val')
        },
        type:'post',
        cache:false,
        dataType:'json',
        success:function(res) {
            if ('is_success' in res) {
                if (res.is_success=='T') {
                    $(obj).find('.XT-hangup').attr('title',res.cur_status_name);
                    $(obj).find('.XT-hangup').attr('_hangup_val',res.cur_status);
                    $(obj).find('.XT-hangup').attr('class','mh_'+res.cur_status+' XT-hangup');
                }
            }else{
                if ('errmsg' in res) {
                    alert(res.errmsg);
                }
            }
        }
    });
});